<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭"
    :footer="null"

  >
    <property-edit-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></property-edit-form>
  </j-modal>
</template>

<script>

  import PropertyEditForm from './PropertyEditForm1'
  export default {
    name: 'PropertyEditModal1',
    components: {
      PropertyEditForm
    },
    data () {
      return {
        title:'',
        width:1200,
        visible: false,
        disableSubmit: false,
        details:true,
        imgList1:false,
      }
    },
    methods: {
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        console.log('record.enrollEndTime',record.enrollEndTime)
        if (record.enrollEndTime){
          let timetime = record.enrollEndTime.split('-')
          let timetime1 = timetime.join('/')

          console.log(timetime1)
          this.$nextTick(()=>{
            this.$refs.realForm.endTime = new Date(record.enrollEndTime).getTime()
            console.log(this.$refs.realForm.endTime)
            this.$refs.realForm.showjishiqi = true
            this.$refs.realForm.imgList1 = this.imgList1
            this.$refs.realForm.edit(record);
          })
        }else {

          this.$nextTick(()=>{
            this.$refs.realForm.endTime = new Date().getTime()-1000
            this.$refs.realForm.showjishiqi = true
            this.$refs.realForm.imgList1 = this.imgList1
            this.$refs.realForm.edit(record);

          })
        }

      },
      close () {
        this.$emit('close');
        console.log('关闭')
        this.$refs.realForm.confirmLoading = false;
        this.$nextTick(()=>{
          this.$refs.realForm.details = true
          this.$refs.realForm.showjishiqi = false
          // this.$refs.realForm.model = {};
        })

        this.$refs.realForm.remark = '';
        // this.$refs.realForm.model = {};
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      },

    }
  }
</script>